import { ReactComponent as Angle } from '@app-cad/assets/svg-icons/constraints/angle.svg';
import { ReactComponent as Tangency } from '@app-cad/assets/svg-icons/constraints/assembly-tangency.svg';
import { ReactComponent as Concentric } from '@app-cad/assets/svg-icons/constraints/concentric.svg';
import { ReactComponent as Distance } from '@app-cad/assets/svg-icons/constraints/distance.svg';
import { ReactComponent as Face } from '@app-cad/assets/svg-icons/constraints/face.svg';
import { ReactComponent as Parallel } from '@app-cad/assets/svg-icons/constraints/parallel.svg';
import { ReactComponent as Perpendicular } from '@app-cad/assets/svg-icons/constraints/perpendicular.svg';
import { ConstraintType } from './type';

const coincidence = ConstraintType.Coincidence;
const parallel = ConstraintType.Parallel;
const perpendicular = ConstraintType.Perpendicular;
const angle = ConstraintType.Angle;
const distance = ConstraintType.Distance;
const tangent = ConstraintType.Tangent;
// 同轴心 接口拆分为同轴和同心
// 同轴
const coincident = ConstraintType.Coincident;
// 同心
const concentric = ConstraintType.Concentric;

export enum SurfaceType {
  Undefined = 0, // 未知
  Plane = 1, // 平面
  Cylinder = 2, // 圆柱
  Cone = 3, // 圆锥
  Sphere = 4, // 球
  Torus = 5, // 圆环
  SurfaceOfExtrusion = 6, // 线性拉伸曲面
  SurfaceOfRevolution = 7, //回转面
  BezierSurface = 8, // 贝塞尔曲面
  BSplineSurface = 9, // B样条曲面
  TrimmedSurface = 10, //裁切曲面
  OffsetSurface = 11, //偏移曲面
  OtherSurface = 12, //其他曲面
}

export const allConstraintList = [
  coincidence,
  parallel,
  perpendicular,
  angle,
  distance,
  tangent,
  coincident,
];

export const constraintMap = [
  {
    name: '相合',
    icon: <Face className='constraintIcon' />,
    const: coincidence,
  },
  {
    name: '平行',
    icon: <Parallel className='constraintIcon' />,
    const: parallel,
  },
  {
    name: '垂直',
    icon: <Perpendicular className='constraintIcon' />,
    const: perpendicular,
  },
  {
    name: '角度',
    icon: <Angle className='constraintIcon' />,
    const: angle,
  },
  {
    name: '距离',
    icon: <Distance className='constraintIcon' />,
    const: distance,
  },
  {
    name: '相切',
    icon: <Tangency className='constraintIcon' />,
    const: tangent,
  },
  {
    name: '同轴心',
    icon: <Concentric className='constraintIcon' />,
    const: coincident,
  },
];

// 球面
const sphere = 'Sphere';
// 圆柱
const cylinder = 'Cylinder';
// 平面
const plane = 'Plane';
// 曲面
const surface = 'Surface';
// 环面
const torus = 'Torus';
// 点
const vertex = 'vertex';
// 直线
const line = 'Line';
// 空间曲线
const spatialCurve = 'Spatial Curve';
// 圆弧
const arcOfCircle = 'ArcOfCircle';
// 圆锥
const cone = 'Cone';
// 圆
const circle = 'Circle';
// 平面曲线（非直线、非圆、非圆弧）
const planarCurve = 'Planar Curve';

export const surfaceList = [sphere, cylinder, torus, cone];

export interface ConstraintListItem {
  format1: string;
  format2: string;
  supportedConstraints: ConstraintType[];
}

// https://udb04vpwa9.feishu.cn/wiki/M5DHwv8T5i1EGgkTbNJcAEL3n2g
export const constraintList: ConstraintListItem[] = [
  {
    format1: arcOfCircle,
    format2: sphere,
    supportedConstraints: [tangent],
  },
  {
    format1: circle,
    format2: sphere,
    supportedConstraints: [tangent],
  },
  {
    format1: plane,
    format2: cylinder,
    supportedConstraints: [tangent, parallel, perpendicular],
  },
  {
    format1: plane,
    format2: sphere,
    supportedConstraints: [tangent],
  },
  {
    format1: plane,
    format2: torus,
    supportedConstraints: [tangent],
  },
  {
    format1: torus,
    format2: torus,
    supportedConstraints: [tangent, coincident, coincidence],
  },
  {
    format1: cylinder,
    format2: cylinder,
    supportedConstraints: [tangent, parallel, perpendicular, coincident],
  },
  {
    format1: sphere,
    format2: sphere,
    supportedConstraints: [tangent, concentric],
  },
  {
    format1: sphere,
    format2: torus,
    supportedConstraints: [tangent],
  },
  {
    format1: vertex,
    format2: vertex,
    supportedConstraints: [coincidence, distance],
  },
  {
    format1: vertex,
    format2: line,
    supportedConstraints: [distance, coincidence],
  },
  {
    format1: vertex,
    format2: spatialCurve,
    supportedConstraints: [coincidence],
  },
  {
    format1: vertex,
    format2: plane,
    supportedConstraints: [coincidence, distance],
  },
  {
    format1: vertex,
    format2: surface,
    supportedConstraints: [coincidence],
  },
  {
    format1: line,
    format2: line,
    supportedConstraints: [
      coincidence,
      parallel,
      perpendicular,
      distance,
      angle,
    ],
  },
  {
    format1: line,
    format2: plane,
    supportedConstraints: [
      coincidence,
      parallel,
      perpendicular,
      distance,
      angle,
    ],
  },
  {
    format1: line,
    format2: cylinder,
    supportedConstraints: [coincident, parallel, perpendicular],
  },
  {
    format1: plane,
    format2: plane,
    supportedConstraints: [
      coincidence,
      parallel,
      perpendicular,
      distance,
      angle,
    ],
  },
  {
    format1: arcOfCircle,
    format2: arcOfCircle,
    supportedConstraints: [coincidence, distance, coincident],
  },
  {
    format1: circle,
    format2: circle,
    supportedConstraints: [coincidence, distance, coincident],
  },
  {
    format1: circle,
    format2: arcOfCircle,
    supportedConstraints: [coincidence, distance, coincident],
  },
  {
    format1: arcOfCircle,
    format2: plane,
    supportedConstraints: [coincidence, distance],
  },
  {
    format1: planarCurve,
    format2: planarCurve,
    supportedConstraints: [coincidence, distance],
  },
  {
    format1: arcOfCircle,
    format2: planarCurve,
    supportedConstraints: [coincidence, distance],
  },
  {
    format1: circle,
    format2: planarCurve,
    supportedConstraints: [coincidence, distance],
  },
  {
    format1: plane,
    format2: planarCurve,
    supportedConstraints: [coincidence, distance],
  },
  {
    format1: surface,
    format2: planarCurve,
    supportedConstraints: [coincidence, distance],
  },
  {
    format1: vertex,
    format2: planarCurve,
    supportedConstraints: [coincidence, distance],
  },
  {
    format1: line,
    format2: planarCurve,
    supportedConstraints: [coincidence, distance],
  },
  {
    format1: cone,
    format2: arcOfCircle,
    supportedConstraints: [coincident],
  },
  {
    format1: cone,
    format2: cone,
    supportedConstraints: [coincident],
  },
  {
    format1: cylinder,
    format2: cone,
    supportedConstraints: [coincident],
  },
];

export const TypesToShowVecSense = [
  [line, cylinder, cone], // line - line
  [plane, circle, arcOfCircle, planarCurve], // plane - plane
];
